using System;
using System.Windows.Forms;

using FreeFlow.Administration;

namespace FreeFlowAdministrator
{
	/// <summary>
	/// Summary description for VersionAdaptor.
	/// </summary>
	public class ProcedureVersionAdaptor : Adaptor, IDeletable
	{
    private FreeFlow.Administration.Version version;
		public ProcedureVersionAdaptor(FreeFlow.Administration.Version version)
		{
      this.version = version;
		}

    public override int ImageIndex
    {
      get
      {
        return 13;
      }
    }

    public override string Text
    {
      get
      {
        return version.VersionNumber.ToString();
      }
    }

    public override Control GetRenderer()
    {
      ProcedureVersionControl control = new ProcedureVersionControl();
      control.LoadVersion(version);
      control.ItemDeleted += new EventHandler(TriggerItemDeleted);
      return control;
    }

    public override object Object
    {
      get
      {
        return version;
      }
    }

    #region IDeletable Members

    public void Delete()
    {
      version.Delete();
    }

    #endregion
  }
}
